<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <!--头部固定引用-->
    <meta charset="utf-8">
    <meta name="full-screen" content="yes">
    <meta name="x5-fullscreen" content="true">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
    <link rel="stylesheet" href="../../css/base.css">
    <link rel="stylesheet" href="../../css/icon-font.css"/><!--图标-->
    <!--固定引用结束,自定义引用添加在下面-->
    <title>更新动态</title>
    <!--页面样式添加在这里，多看看base。css里面的公共样式，大部分常用的都有，避免使用独立css文件为单独页面设置样式，避免随意添加样式到公共样式-->
    <style>
        .user-versionHis-module {
            position: relative;
        }

        .user-versionHis-round {
            position: absolute;
            width: 0.18rem;
            height: 0.18rem;
            left: -0.1rem;
            top: -0.1rem;
            background: rgba(255, 255, 255, 1);
            border-radius: 20rem;
            border: 2px solid rgba(44, 104, 255, 1);
        }

        .user-versionHis-versionCode {
            position: absolute;
            left: 0.26rem;
        }

        .user-versionHis-date {
            position: absolute;
            left: 5.12rem;
            color: rgba(34, 34, 34, 0.45);
        }

        .user-versionHis-message {
            padding: 0.28rem 0.28rem 0.28rem 0.28rem;
            color: rgba(34, 34, 34, 1);
            background: #FFFFFFFF;
            line-height: 0.44rem;
        }

        .user-versionHis-totalVersion {
            margin-right: 0.6rem;
            padding-bottom: 0.08rem;
            margin-left: 0.32rem;
            border-left: 1px solid rgba(231, 231, 231, 1);
        }

        .user-versionHis-totalVersionWithout {
            margin-right: 0.6rem;
            padding-bottom: 0.08rem;
            margin-left: 0.32rem;
        }

        .user-versionHis-messageBack {
            margin-top: 0.3rem;
            margin-left: 0.26rem;
            margin-bottom: 0.7rem;
        }

        .user-versionHis-list {
            margin-top: 0.72rem;
        }
    </style>
</head>
<!--尽量不要在body上添加样式，除了背景色-->
<body>
<div class="flex-column ff400 fs14 h-100-p">
    <!--头部部分-->
    <div class="placeholder-top">
        <!--状态栏-->
        <div class="bg-main status-bar pos-f"></div>
        <!--导航栏-->
        <div class="bg-main nav-bar pos-f flex-row justify-content-between c-white align-items-center">
            <div class="left-bar" onclick="clickBack()">
                <span class="iconfont iconfanhui1 fs16"></span>
            </div>
            <div class="flex-row center-bar fs16 ff500 line1">更新动态</div>
            <div class="right-bar">
            </div>
        </div>
    </div>
    <div class="pos-r flex-1 scoll-y">
        <div class="flex-row justify-content-center align-items-center"></div>
        <div class="user-versionHis-list"></div>
    </div>
</div>
</body>
<!--下面四个文件为固定引用，自己根据情况调整路径，不要跟换引入顺序，其他引用添加在后面-->
<script src="../../js/dict.js"></script>
<script src="../../js/jquery-3.4.1.min.js"></script>
<script src="../../js/checkJsBridge.js"></script>
<script src="../../js/utils.js"></script>
<script src="../../js/date.js"></script>
<script src="../../js/api.js"></script>

<!--固定引用结束-->
<!--避免一个页面包含过多功能，减少js重绘页面，推荐分功能，分页面-->
<script>
    let pm = {}

    /*固定页面初始化方法，用于替代$(function(){}),param为url参数，Object类型*/
    function initPage() {
      //状态栏自适应
      Utils.sbhAdaptive()
      getVersionHisList()
    }

    /*页面所在窗口由后台前台时触发的方法,param为url参数，Object类型*/
    function startPage(params) {
      getVersionHisList()
    }

    function reLoadPage() {
      getVersionHisList()
    }

    //获取历史版本更新信息
    function getVersionHisList() {
      let versionShowStr = ''
      let reg = /[;；]/g
      Server.versionHistory.getVersionHisList().then(
        function (data) {
          pm.versionHis = data.versionHis
          let i = 0
          pm.versionHis.forEach(
            function (item) {
              if (i === pm.versionHis.length - 1) {
                versionShowStr += ' <div class="user-versionHis-totalVersionWithout">'
              } else {
                versionShowStr += ' <div class="user-versionHis-totalVersion">'
              }
              i++
              // <!--版本号与日期那一行-->
              versionShowStr += '<div class="user-versionHis-module flex-row align-items-center justify-content-between">'
              // <!--蓝色圆圈-->
              versionShowStr += '<div class=" user-versionHis-round"></div>'
              // <!--版本号-->
              versionShowStr += '<span class="user-versionHis-versionCode ff500 fs15">' + 'V' + item.versionNum + '</span>'
              // <!--日期-->
              versionShowStr += '<div class=\'user-versionHis-date fs12 \'>' + DateUtils.int2Str(item.releaseDttm * 1000, 'yyyy-MM-dd') + '</div>'
              versionShowStr += '</div>'
              // <!--历史更新信息-->
              versionShowStr += '<div class="user-versionHis-messageBack align-items-center justify-content-between">'
              // <!--文字信息-->
              versionShowStr += '<div class="user-versionHis-message align-items-center justify-content-between fs14 ff400">' + item.versionContent.replace(reg, '；<br>') + '</div>'
              versionShowStr += '</div>'
              versionShowStr += '</div>'
            }
          )
          if (pm.pageNum === 1) {
            $('.user-versionHis-list').html(versionShowStr)
          } else {
            $('.user-versionHis-list').append(versionShowStr)
          }
        }
      ).catch(jsBridge.log)
    }
</script>
</html>